package com.fast.develop.integration.orm;

import com.fast.develop.core.data.Page;
import com.fast.develop.core.data.Pageable;
import com.fast.develop.core.persistence.BatchObject;
import com.fast.develop.core.persistence.DomainModelManager;
import com.fast.develop.meta.base.MetaConfiguration;
import org.hibernate.Session;

import java.io.Serializable;
import java.util.List;

/**
 * @author 莫寅
 * @createTime 2022-06-05 05:09
 * @desc：
 */
public class DomainModelSessionManager implements DomainModelManager {

    private DomainModelManager domainModelManager;

    public DomainModelSessionManager(MetaConfiguration metaConfiguration, Session session) {
        this.domainModelManager = new DomainModelSessionManagerWrapper(metaConfiguration, session);
    }

    @Override
    public List list(String model){
        return domainModelManager.list(model);
    }

    @Override
    public Page page(String model, Pageable pageable){
        return domainModelManager.page(model, pageable);
    }

    @Override
    public Object get(String model, Serializable serializable){
        return domainModelManager.get(model, serializable);
    }


    @Override
    public Serializable create(String model, Object object){
        return domainModelManager.create(model, object);
    }

    @Override
    public BatchObject batch(String model, BatchObject batchObject){
        return domainModelManager.batch(model, batchObject);
    }

    @Override
    public void update(String model, Serializable id, Object object){
        domainModelManager.update(model, id, object);
    }


    @Override
    public void delete(String model, Serializable id){
        domainModelManager.delete(model, id);
    }
}
